home *** CD-ROM | disk | FTP | other *** search
- Path: cpsc.ucalgary.ca!davidt
- From: davidt@cpsc.ucalgary.ca (David Taylor)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: H E L P
- Date: 5 Apr 1996 22:03:55 GMT
- Organization: University of Calgary CPSC
- Message-ID: <4k45cb$j5a@linux.cpsc.ucalgary.ca>
- References: <N.040296.013047.18@DynamicPPP-185.HIP.CAM.ORG> <Pine.A32.3.91.960402135001.121719B-100000@green.weeg.uiowa.edu> <4js6jh$ndr@solutions.solon.com>
- NNTP-Posting-Host: bh.cpsc.ucalgary.ca
-
- In article <4js6jh$ndr@solutions.solon.com>,
- Peter Seebach <seebs@solutions.solon.com> wrote:
- >In article <Pine.A32.3.91.960402135001.121719B-100000@green.weeg.uiowa.edu>,
- >The Amorphous Mass <robinson@blue.weeg.uiowa.edu> wrote:
- >>On Tue, 2 Apr 1996 ramrod@cam.org wrote:
- >
- >>> The part that I am having a hard time with is the part that
- >>> whatever number I enter for the age, I'm supposed to get the same number
- >>> of happy faces, automatically. For example If I say I am 45 years old,
- >>> then the program should show 45 happy faces.
- >
- >> You need a loop. Look up the for, while, and do while loop constructs in
- >>your textbook.
- >
- >This is a bit strong. You don't *need* a loop. You just probably want one.
- >
- >Obviously, if you're assuming age, you would have no more than about 150 ifs
- >to test, (assuming humans), and if you just want to do it for 45, it's even
- >easier.
- >
-
- There is also the recursive technique....
-
- void print_n_faces (int n) {
- if (n > 0) {
- printf ("\001");
- print_n_faces (n - 1);
- }
- }
-
- --
- Andrew Taylor |email: davidt@cpsc.ucalgary.ca
- |www: http://www.cpsc.ucalgary.ca/~davidt
-